#!/bin/bash

cd $(dirname $0)

docker build -t aries-cloudagent-test -f ../docker/Dockerfile.test .. || exit 1

if [ ! -d ../test-reports ]; then mkdir ../test-reports; fi

# on Windows, docker run needs to be prefixed by winpty
if [ "$OSTYPE" == "msys" ]; then
  DOCKER="winpty docker"
else
  DOCKER="docker"
fi

$DOCKER run --rm -ti --name aries-cloudagent-runner \
	-v "$(pwd)/../test-reports:/usr/src/app/test-reports" \
	aries-cloudagent-test "$@"
